# include to make a console application
define setupCommonVC
	cc := cl
# copts from mathlink application	
	copts:=/Od  /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D  /Gm /EHa /RTC1 /MDd /W3 /nologo /c /ZI /TP /errorReport:prompt /Fd"projectDebug\\"
	testcopts := /Od  /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D  /Gm /EHa /RTC1 /MDd /W3 /nologo /c  /ZI /TP /errorReport:prompt /Fd"projectDebug\\"
#"_VC80_UPGRADE=0x0710" /D "_MBCS"
#copts := /nologo /c /EHsc /DWIN32 /D_WINDOWS /W3 /Z7 /Od /D_DEBUG
#	copts := /c /D_DEBUG /EHsc /D"_CONSOLE" /RTC1 /MDd
	objext := obj
	objout := /Fo
	exeout := /Fe
	incdir := $(patsubst %,/I%,$(addincdir))	
#	libdir := /link /nologo /subsystem:windows /DEBUG /INCREMENTAL:no $(patsubst %,/LIBPATH:%,$(addlibdir))
	libdir = /link /nologo /DEBUG /INCREMENTAL:no $(patsubst %,/LIBPATH:%,$(addlibdir))
	libraries := kernel32.lib user32.lib gdi32.lib
	libraries += $(patsubst %,%.lib,$(addlibs))
	testlibraries = $$(libraries)
endef

define setupCommonMinGW
	copts := -c -g -Wall
	testcopts := -c -g -Wall
	objout := -o
	objext := o
	exeout := -o
#perhaps semicolon separted list?
	incdir := $(patsubst %,-I%,$(addincdir))
	libdir := $(patsubst %,-L%,$(addlibdir))
	libraries := $(addlibs) -mwindows 
	testlibraries := $$(libraries) -mconsole
#	extra $ because using eval
#	libraries := $(patsubst %,-l%,$(addlibs))
#	-mwindows if not console?	probable want different test and executable options
#	libraries += $(additionalLibs)
endef

define setupVC71
	$(setupCommonVC)
	copts += /MLd /Wp64
endef

define setupVC8
	$(setupCommonVC)
	copts += /D_CRT_SECURE_NO_WARNINGS
endef

define setupVC9
	$(setupCommonVC)
	copts += /D_CRT_SECURE_NO_WARNINGS
endef

define setupMinGW
	$(setupCommonMinGW)
	cc = g++
endef
define setupMinGW421
	$(setupCommonMinGW)
	cc = g++-sjlj
endef
$(eval $(setup$(version)))